# -*- encoding: utf-8 -*-
'''
file       :decode_pic_to_file.py
Description: 解码图片并把解码数据转为文件
Date       :2022/12/22 09:34:48
Author     :Josco
version    :python3.7.8
'''

from config import standard_pic, standard_ori_pic, camera_2, ori_pic_file_path, pic_file_path
from dynamics_demarcate_pix import dynamics_demarcate_pix
from decode_shoot_pic import decode_shoot_pic
from public import load_ori_and_shoot_pic



def main():
    # 基于标准的图像和标准拍摄后的图像调用动态获取点位矩阵函数获取每日的动态点位矩阵
    camera = camera_2
    do_dynamics_demarcate_pix = dynamics_demarcate_pix()
    all_dynamics_point_matrix = do_dynamics_demarcate_pix.turn_pic(standard_pic, standard_ori_pic,camera)  # 获取到动态点位的矩阵
    
    # 利用动态点位矩阵进行验证
    do_decode_shoot_pic = decode_shoot_pic()

    # ori_pic, shoot_pic = "./DebugImg/ori/1.bmp", "./DebugImg/pic/1.bmp"
    # do_decode_shoot_pic.do_decode(all_dynamics_point_matrix, shoot_pic,  ori_pic)

    # 遍历原始图像和拍摄后的图像并把地址汇聚成list
    ori_pic_file_list, pic_file_list = load_ori_and_shoot_pic(
        ori_pic_file_path, pic_file_path)
    print()
    print()
    print()
    print()
    print("现在开始利用所得的动态点位矩阵信息进行验证：")
    for ori_pic, shoot_pic in zip(ori_pic_file_list, pic_file_list):
        print("现在轮到%s的图片进行验证========================================================" % shoot_pic)
        do_decode_shoot_pic.do_decode(all_dynamics_point_matrix, shoot_pic,  ori_pic)
    



if __name__ == "__main__":
    main()